<template>
  <div class="first">
    <!-- <h2>首页</h2> -->
    <div class="left">
      <div class="left-top">
        <money></money>
      </div>
      <div class="left-center" id="lef-center"></div>
      <div class="left-bottom">
        <div id="lef-bottom-left"></div>
        <div id="lef-bottom-right"></div>
      </div>
    </div>
    <div class="right">
      <div id="right-top">
        <el-calendar v-model="value"> </el-calendar>
      </div>
      <div id="right-bottom">
        <dl>
          <li v-for="(item, index) in arr" :key="index">
            {{ item.titles }}
          </li>
        </dl>
      </div>
    </div>
  </div>
</template>

<script>
import * as echarts from "echarts";
import money from "../money.vue";
export default {
  name: "VscodeInsidersHome",

  data() {
    return {
      value: new Date(),
      arr: [],
    };
  },
  components: {
    money,
  },
  mounted() {
    this.eachat();
    this.scol();
    this.zhuzi();
    this.zexian();
    this.pie();
    this.zhu();
    this.data();
  },

  methods: {
    eachat() {},
    scol() {},
    zhuzi() {},
    zexian() {
      var chartDom = document.getElementById("lef-center");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        yAxis: {
          type: "value",
        },
        grid: {
          width: 500,
          height: 100,
        },
        series: [
          {
            data: [150, 230, 224, 218, 135, 147, 260],
            type: "line",
          },
        ],
      };

      option && myChart.setOption(option);
    },
    pie() {
      var chartDom = document.getElementById("lef-bottom-left");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          left: "center",
        },
        series: [
          {
            name: "Access From",
            type: "pie",
            radius: ["40%", "70%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
            },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "40",
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048 },
              { value: 735 },
              { value: 580 },
              { value: 484 },
              { value: 300 },
            ],
          },
        ],
      };

      option && myChart.setOption(option);
    },
    zhu() {
      var chartDom = document.getElementById("lef-bottom-right");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: "bar",
          },
        ],
      };

      option && myChart.setOption(option);
    },
    data() {
      this.$http.get("http://localhost:3001/searchtxt", {}).then((res) => {
        console.log(res.data);
        this.arr = res.data;
      });
    },
  },
};
</script>

<style  scoped>
.right {
  width: 30%;
  height: 100%;
  /* background-color: aqua; */
  float: left;
}
#right-top {
  width: 100%;
  /* border: 1px red solid; */
}
.first {
  width: 100%;
  height: 100vh;
  /* background-color:black; */
  /* border: 1px red solid; */
}
::v-deep .el-calendar__header {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #ebeef5;
  background-color: #19d28f;
  border-radius: 5px;
  margin-left: 10px;
}
.left {
  width: 50%;
  float: left;
}
.left-top {
  /* padding-right: 20px; */
  display: flex;
  width: 100%;
  height: auto;
}

.left-center {
  width: 100%;
  height: 200px;
  /* background-color: rosybrown; */
  /* border: 1px red solid; */
}
.left-bottom {
  display: flex;
  width: 100%;
  height: 200px;
  /* background-color: rosybrown; */
  /* border: 1px red solid; */
}
#lef-bottom-left {
  width: 50%;
  height: 200px;
  background-color: aqua;
}
#lef-bottom-right {
  width: 49%;
  height: 200px;
  /* background-color: red; */
}
#right-bottom {
  height: 200px;
  overflow-y: auto;
}
#right-bottom li {
  list-style: none;
  padding-left: 5px;
}
#main {
  width: 20%;
  height: 200px;
  /* overflow: a; */
  border: 1px red solid;
}
#main2 {
  width: 40%;
  height: 200px;
  /* overflow: a; */
  /* border: 1px red solid; */
  word-break: break-all;
  overflow: hidden;
}
#main3 {
  width: 40%;
  height: 200px;
  /* overflow: a; */
  /* border: 1px red solid; */
}
::v-deep .el-calendar-day {
  box-sizing: border-box;
  padding: 8px;
  height: 35px;
}
::v-deep.el-backtop ::v-deep .el-calendar-table td.is-today {
  color: red;
  /* background-color:aqua; */
}
</style>